<%--
  Created by IntelliJ IDEA.
  User: 余先生
  Date: 2021/6/7
  Time: 11:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Title</title>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>

    <style>
        div{text-align: center;}
        td{text-align: center;}
        th{text-align: center;}
    </style>
</head>
<body>
<div class="jumbotron" style="background-color: #c1edcf">
    <h1>欢迎登陆本网站</h1>
    <p>(｀・ω・´)</p>
    <p> <a class="btn btn-primary btn-lg glyphicon glyphicon-plus" href="${pageContext.request.contextPath}/showGrade" role="button">点击添加学生</a>
        &nbsp;
        <a class="btn btn-primary btn-lg glyphicon glyphicon-search" href="${pageContext.request.contextPath}/showStudent" role="button">点击查看所有学生</a>
    </p>
</div>

<div class="row clearfix">
    <div class="col-md-12 column">
        <table class="table table-hover table-striped">
          <thead>
          <tr align="center">
                <th>学号</th>
                <th>姓名</th>
                <th>年龄</th>
                <th>性别</th>
                <th>地址</th>
                <th>状态</th>
                <th>生日</th>
                <th>年级编号</th>
                <th>年级名称</th>
                <th style="background-color: beige">操作</th>
            </tr>
          </thead>
        <tbody>
        <c:forEach items="${pageInfo.list}" var="s">
                <tr>
                    <td>${s.xh}</td>
                    <td>${s.name}</td>
                    <td>${s.age}</td>
                    <td>${s.sex}</td>
                    <td>${s.address}</td>
                    <td>${s.state}</td>
                    <td><fmt:formatDate value="${s.birthday}" pattern="yyyy-MM-dd"/></td>
                    <td>${s.gid}</td>
                    <td>${s.gname}</td>
                    <td style="background-color: beige">
                        <a style="color: red" href="JavaScript:if(confirm('你确定要删除当前学生的信息吗?')){location.href='/deleteStudent?xh=${s.xh}'}"><span class="glyphicon glyphicon-remove">删除</span></a> |
                        <a style="color: blue" href="/selectOneStu?xh=${s.xh}"><span class="glyphicon glyphicon-refresh">修改</span></a>
                    </td>
                </tr>
            </c:forEach>
        </tbody>
        </table>
        <div>
            当前是第${pageInfo.pageNum}页/共${pageInfo.pages}页，每页${pageInfo.pageSize}条/共${pageInfo.total}条
        </div>
        <nav class="navbar navbar-default navbar-fixed-bottom ">
            <div class="container">
                <nav aria-label="...">
                    <ul class="pager">
                        <li>
                            <c:if test="${pageInfo.prePage!=0}">
                                <a href="showStudentByPage?page=${pageInfo.prePage}">上一页</a>
                            </c:if>
                        </li>
                        <li>
                            <c:if test="${pageInfo.nextPage!=0}">
                                <a href="showStudentByPage?page=${pageInfo.nextPage}">下一页</a>
                            </c:if>
                        </li>
                    </ul>
                </nav>
                <nav aria-label="Page navigation">
                    <ul class="pagination">
                        <li>
                            <a href="showStudentByPage?page=1" aria-label="Previous">
                                <span aria-hidden="true">首页</span>
                            </a>
                        </li>
                        <c:forEach var="num" begin="1" end="${pageInfo.pages}">
                            <li><a href="showStudentByPage?page=${num}">${num}</a></li>
                        </c:forEach>
                        <li>
                            <a href="showStudentByPage?page=${pageInfo.pages}" aria-label="Next">
                                <span aria-hidden="true">尾页</span>
                            </a>
                        </li>
                    </ul>
                </nav>
            </div>
        </nav>
    </div>
</div>

</body>
</html>
